package com.oepm.web.controller;

import com.oepm.biz.WelcomeBiz;
import com.oepm.common.entity.Meta;
import com.oepm.common.entity.Result;
import com.oepm.common.utils.JWTUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.jar.JarEntry;

@CrossOrigin
@RestController
public class WelcomeController {
    @Autowired
    WelcomeBiz welcomeBiz;

    /**
     * 欢迎菜单教师待审核数量
     * @param request
     * @return
     */
    @GetMapping("/welcome/selectTea")
    public Result selectTea(HttpServletRequest request){
        String token = request.getHeader("Authorization");
        String id = JWTUtil.getUserId(token);
        Integer num = welcomeBiz.selectTea(id);
        Result result = new Result(Meta.SUCCESS,num);
        return result;
    }
}
